using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace RiceShop.Models
{
    /// <summary>
    /// 售后服务实体类
    /// </summary>
    public class AfterService
    {
        /// <summary>
        /// 售后ID，主键
        /// </summary>
        [Key]
        public long Id { get; set; }

        /// <summary>
        /// 订单编号，关联订单表
        /// </summary>
        [Required]
        [StringLength(32)]
        public string OrderNo { get; set; } = string.Empty;

        /// <summary>
        /// 用户ID，关联用户表
        /// </summary>
        [Required]
        public long UserId { get; set; }

        /// <summary>
        /// 售后类型（1:退款,2:退货退款）
        /// </summary>
        public byte Type { get; set; }

        /// <summary>
        /// 售后原因
        /// </summary>
        [Required]
        [StringLength(500)]
        public string Reason { get; set; } = string.Empty;

        /// <summary>
        /// 退款金额
        /// </summary>
        [Required]
        [Column(TypeName = "decimal(18,2)")]
        public decimal Amount { get; set; }

        /// <summary>
        /// 售后状态（0:待处理,1:处理中,2:已完成,3:已拒绝）
        /// </summary>
        public byte Status { get; set; }

        /// <summary>
        /// 凭证图片，JSON格式
        /// </summary>
        public string? Images { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime UpdateTime { get; set; }

        /// <summary>
        /// 是否删除（软删除）
        /// </summary>
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 关联的订单实体
        /// </summary>
        [ForeignKey("OrderNo")]
        public virtual Order? Order { get; set; }

        /// <summary>
        /// 关联的用户实体
        /// </summary>
        [ForeignKey("UserId")]
        public virtual User? User { get; set; }
    }
}